package org.TCPcase2;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket=new ServerSocket(10086);
        Socket accept = serverSocket.accept();
        BufferedWriter bufferedWriter=new BufferedWriter(new OutputStreamWriter(accept.getOutputStream()));
        BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(accept.getInputStream()));
        String s = bufferedReader.readLine();
        System.out.println(s);
        bufferedWriter.write("服务端数据"+"\n");
        bufferedWriter.flush();
        accept.shutdownOutput();
        accept.close();
        serverSocket.close();
    }
}
